/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024.
 * Description: header file for vm mode vnotify
 * Author: wanglinhui <wanglinhui@huawei.com>
 * Create: 2024-06-24
 */

#ifndef VM_VNOTIFY_H
#define VM_VNOTIFY_H

#include <linux/types.h>
#ifdef CONFIG_ARM64
#include <linux/kvm_host.h>
#endif
#include <linux/task_struct_extend.h>
#include "vnotify.h"

enum {
	HPVISOR_EVENT_POLL,
	HPVISOR_EVENT_WAKE,
	HPVISOR_EVENT_READ,
	HPVISOR_EVENT_MAX_NR
};

#define HPVISOR_MMU_CACHE_THREAD_NUM 2

#define HPVISOR_GUEST_IPI_NUM 8

void hpvisor_vnotify_release(const struct kvm *kvm);
void hpvisor_vnotify_record_write(u8 event, u32 id, u32 count);
struct page *hpvisor_vnotify_get_ctrl_mem_page(const struct kvm *kvm, struct vm_fault *vmf);

int hpvisor_ioctl_vnotify_init(struct kvm *kvm, unsigned long arg);

extern void hpvisor_vnotify_send_ipi(int cpu);
bool check_task_perm(void);

#endif /* VM_VNOTIFY_H */
